From 7b4fe715a53b0fa88dcb3a53bc2b9455a9e8c043 Mon Sep 17 00:00:00 2001 From: "emellor@leeni.uk.xensource.com" Date: Thu, 8 Dec 2005 12:08:59 +0000 Subject: [PATCH] Refuse to save dom0, and move the check that refuses to migrate dom0 from migrate.py into XendDomain. Signed-off-by: Ewan Mellor --- tools/python/xen/xend/XendDomain.py | 6 ++++++ tools/python/xen/xm/migrate.py | 7 +------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/python/xen/xend/XendDomain.py b/tools/python/xen/xend/XendDomain.py index c5510c8aad..e04361556e 100644 --- a/tools/python/xen/xend/XendDomain.py +++ b/tools/python/xen/xend/XendDomain.py @@ -395,6 +395,9 @@ class XendDomain: dominfo = self.domain_lookup(domid) + if dominfo.getDomid() == PRIV_DOMAIN: + raise XendError("Cannot migrate privileged domain %i" % domid) + port = xroot.get_xend_relocation_port() try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) @@ -416,6 +419,9 @@ class XendDomain: try: dominfo = self.domain_lookup(domid) + if dominfo.getDomid() == PRIV_DOMAIN: + raise XendError("Cannot save privileged domain %i" % domid) + fd = os.open(dst, os.O_WRONLY | os.O_CREAT | os.O_TRUNC) try: # For now we don't support 'live checkpoint' diff --git a/tools/python/xen/xm/migrate.py b/tools/python/xen/xm/migrate.py index ec3d16bb46..cc81ded89e 100644 --- a/tools/python/xen/xm/migrate.py +++ b/tools/python/xen/xm/migrate.py @@ -13,6 +13,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #============================================================================ # Copyright (C) 2004, 2005 Mike Wray +# Copyright (c) 2005 XenSource Ltd. #============================================================================ """Domain migration. @@ -23,9 +24,6 @@ import sys from xen.xend.XendClient import server from xen.xm.opts import * -DOM0_NAME = 'Domain-0' -DOM0_ID = '0' - gopts = Opts(use="""[options] DOM HOST Migrate domain DOM to host HOST. @@ -58,7 +56,4 @@ def main(argv): opts.err('Invalid arguments: ' + str(args)) dom = args[0] dst = args[1] - if dom in [DOM0_NAME, DOM0_ID]: - opts.err('Cannot migrate ' + dom) server.xend_domain_migrate(dom, dst, opts.vals.live, opts.vals.resource) - -- 2.30.2